package project.Controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import project.Pojo.Result;
import project.Pojo.WordCount;
import project.Service.WordService;

import java.util.List;

@RestController
@Tag(name = "单词统计相关接口")
@CrossOrigin
@RequestMapping("/word")
public class WordControler {
    @Autowired
    private WordService wordService;
    @PostMapping("/getword")
    @Operation(summary = "获取单词数前10")
    public Result  getWordConuntByUserName(@RequestParam String username){
        wordService.processChatContent(username);
        List<WordCount> wordCounts = wordService.getWordCountByUserName(username);
        return Result.success(wordCounts);
    }
    @PostMapping("/getevaluation")
    public Result getAiEvaluation(@RequestParam String username){
        String evaluation=wordService.gerAiEvalution(username);
        return Result.success(evaluation);

    }
}
